package com.glsc.ngateway.common.base.domain.mysql.flowable;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 流程明细表
 */
@Entity
@Table(name = "t_flowable_detail")
@Inheritance(strategy = InheritanceType.JOINED)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class FlowableDetail implements Serializable {

    @ApiModelProperty(value = "唯一编号")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "l_id", columnDefinition = "int comment '唯一编号'")
    private Integer id;

    @ApiModelProperty(value = "流程实例id")
    @Column(name = "vc_process_instance_id", columnDefinition = "varchar(64) '")
    private String processInstanceId;

    @ApiModelProperty(value = "流程定义名称")
    @Column(name = "vc_process_define_name", columnDefinition = "varchar(255) '")
    private String processDefineName;

    @ApiModelProperty(value = "流程标题")
    @Column(name = "vc_title", columnDefinition = "varchar(255) '")
    private String title;

    @ApiModelProperty(value = "任务id")
    @Column(name = "vc_task_id", columnDefinition = "varchar(64) '")
    private String taskId;

    @ApiModelProperty(value = "任务名称")
    @Column(name = "vc_task_name", columnDefinition = "varchar(255) '")
    private String taskName;

    @ApiModelProperty(value = "流程定义id")
    @Column(name = "vc_process_define_id", columnDefinition = "varchar(64) '")
    private String processDefineId;

    @ApiModelProperty(value = "第三方系统名称")
    @Column(name = "vc_sysid", columnDefinition = "varchar(100) '")
    private String sysid;

    @ApiModelProperty(value = "用户名称")
    @Column(name = "vc_username", columnDefinition = "varchar(100) '")
    private String username;

    @ApiModelProperty(value = "流程表单内容")
    @Column(name = "vc_content", columnDefinition = "varchar(4096) '")
    private String content;

    @ApiModelProperty(value = "操作时间")
    @Column(name = "dt_op_time", columnDefinition = "datetime comment '操作时间'")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime opTime;

    @ApiModelProperty(value = "接口名称")
    @Column(name = "vc_interface_name", columnDefinition = "varchar(50) '")
    private String interfaceName;

    @ApiModelProperty(value = "流程实例状态")
    @Column(name = "c_process_status", columnDefinition = "varchar(5)")
    private String processStatus;

    @ApiModelProperty(value = "需求创建时间")
    @Column(name = "dt_create_time", columnDefinition = "datetime")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime createTime;

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public String getProcessStatus() {
        return processStatus;
    }

    public void setProcessStatus(String processStatus) {
        this.processStatus = processStatus;
    }

    public String getInterfaceName() {
        return interfaceName;
    }

    public void setInterfaceName(String interfaceName) {
        this.interfaceName = interfaceName;
    }

    public String getProcessDefineName() {
        return processDefineName;
    }

    public void setProcessDefineName(String processDefineName) {
        this.processDefineName = processDefineName;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getProcessInstanceId() {
        return processInstanceId;
    }

    public void setProcessInstanceId(String processInstanceId) {
        this.processInstanceId = processInstanceId;
    }


    public String getTaskId() {
        return taskId;
    }

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public String getProcessDefineId() {
        return processDefineId;
    }

    public void setProcessDefineId(String processDefineId) {
        this.processDefineId = processDefineId;
    }

    public String getSysid() {
        return sysid;
    }

    public void setSysid(String sysid) {
        this.sysid = sysid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public LocalDateTime getOpTime() {
        return opTime;
    }

    public void setOpTime(LocalDateTime opTime) {
        this.opTime = opTime;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Override
    public String toString() {
        return "FlowableDetail{" +
                "id=" + id +
                ", processInstanceId='" + processInstanceId + '\'' +
                ", processDefineName='" + processDefineName + '\'' +
                ", title='" + title + '\'' +
                ", taskId='" + taskId + '\'' +
                ", taskName='" + taskName + '\'' +
                ", processDefineId='" + processDefineId + '\'' +
                ", sysid='" + sysid + '\'' +
                ", username='" + username + '\'' +
                ", content='" + content + '\'' +
                ", opTime=" + opTime +
                ", interfaceName='" + interfaceName + '\'' +
                ", processStatus='" + processStatus + '\'' +
                ", createTime=" + createTime +
                '}';
    }
}
